<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script>
    <script>
      // 初始化
      var vConsole = new VConsole();
      console.log("Hello world");
    </script>
    <title>转跳中...</title>
    <style lang="scss">
      @keyframes loading {
        0% {
          opacity: 0;
        }
        100% {
          opacity: 1;
        }
      }
      .dark-loading,
      .light-loading {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 99999;
      }
      .dark-loading .box h2,
      .light-loading .box h2 {
        color: #777;
        margin: 0;
        font: 0.8em verdana;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        text-align: center;
      }
      .dark-loading .box span,
      .light-loading .box span {
        display: inline-block;
        vertical-align: middle;
        width: 0.6em;
        height: 0.6em;
        margin: 0.19em;
        background: #007db6;
        border-radius: 0.6em;
        -webkit-animation: loading 1s infinite alternate;
        animation: loading 1s infinite alternate;
      }
      .dark-loading .box span:nth-of-type(2),
      .light-loading .box span:nth-of-type(2) {
        background: #008fb2;
        -webkit-animation-delay: 0.2s;
        animation-delay: 0.2s;
      }
      .dark-loading .box span:nth-of-type(3),
      .light-loading .box span:nth-of-type(3) {
        background: #009b9e;
        -webkit-animation-delay: 0.4s;
        animation-delay: 0.4s;
      }
      .dark-loading .box span:nth-of-type(4),
      .light-loading .box span:nth-of-type(4) {
        background: #00a77d;
        -webkit-animation-delay: 0.6s;
        animation-delay: 0.6s;
      }
      .dark-loading .box span:nth-of-type(5),
      .light-loading .box span:nth-of-type(5) {
        background: #00b247;
        -webkit-animation-delay: 0.8s;
        animation-delay: 0.8s;
      }
      .dark-loading .box span:nth-of-type(6),
      .light-loading .box span:nth-of-type(6) {
        background: #5ab027;
        -webkit-animation-delay: 1s;
        animation-delay: 1s;
      }
      .dark-loading .box span:nth-of-type(7),
      .light-loading .box span:nth-of-type(7) {
        background: #a0b61e;
        -webkit-animation-delay: 1.2s;
        animation-delay: 1.2s;
      }
    </style>
  </head>
  <body>
    <div class="light-loading">
      <div class="box">
        <h2>Loading</h2>
        <span></span><span></span><span></span><span></span><span></span
        ><span></span><span></span>
      </div>
    </div>
    <script>
      let userAgent = navigator.userAgent.toLowerCase();
      if (userAgent.indexOf("micromessenger") != -1) {
        if (userAgent.indexOf("wxworklocalcustomized") > -1) {
          console.log("粤政易环境");
          goYzy();
        } else {
          console.log("微信环境");
          goNormal();
        }
      } else if (userAgent.indexOf("alipayclient") != -1) {
        // alert("支付宝环境:" + userAgent);
        goNormal();
      } else {
        // alert("其他环境:" + userAgent);
        goNormal();
      }
      function goYzy() {
        let url = `${document.location.protocol}//${window.location.hostname}${
          window.location.port ? ":" + window.location.port : ""
        }/cmdb/yzy/oauth?device=${GetRequest()?.device}`;
        //粤政易报障
        window.location.replace(url);
      }

      function goNormal() {
        let url = `${document.location.protocol}//${window.location.hostname}${
          window.location.port ? ":" + window.location.port : ""
        }/cmdb-mobile/Property/PropertyDetail/${GetRequest()?.device}`;
        window.location.replace(url);
      }
      //  获取?后面的地址
      function GetRequest() {
        var url = location.search;
        //获取url中"?"符后的字串
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
          var str = url.substr(1);
          strs = str.split("&");
          for (var i = 0; i < strs.length; i++) {
            theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
          }
        }
        return theRequest;
      }
    </script>
  </body>
</html>
